/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package funciones;


import java.awt.PageAttributes;
import java.awt.print.PageFormat;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.swing.JPanel;

/**
 *
 * @author Jesus Ruiz Oliva
 */
public class Imprime
{
   
   public Imprime (JPanel panel)
   {
      PrinterJob job = PrinterJob.getPrinterJob();     
      job.setPrintable(new ObjetoAImprimir(panel));
      
      if (job.printDialog())
      {
         try { 
             job.print();
         }
         catch (PrinterException e) { System.out.println("Error de impresión: " + e); }
      }
      
   }
}
